package br.com.gustavobhz.testes;

import java.applet.Applet;
import java.io.InputStream;
import java.net.URL;
import java.net.URLClassLoader;

public class URLClassLoaderTest extends Applet {

    /**
	 * Gerado automaticamente
	 */
	private static final long serialVersionUID = 1L;

	public void init(){
        try{
            ((Applet)URLClassLoader.newInstance(new URL[]{getCodeBase()},null).loadClass(URLClassLoaderTest.class.getName()).newInstance()).play(getCodeBase());
        }
        catch(Exception e){
            e.printStackTrace();
        }
    }
    
    public void play(URL codeBase){
        try{
            InputStream is= getClass().getResourceAsStream("test.xml");
            while(is.read()!=-1);
            is.close();
        }
        catch(Exception e){
            e.printStackTrace();
        }
    }
    
}